/*
 * @Author: 姚潘涛
 * @Date: 2024-04-08 15:18:03
 * @LastEditors: 姚潘涛
 * @LastEditTime: 2024-10-10 16:10:34
 * @Description:
 *
 * Copyright (c) 2024 by pandaman, All Rights Reserved.
 */
#include "xict_driver/utils/data_converter.h"
#include "xict_common/log/log.h"

namespace xict_driver {
    namespace utils {
        DataConverter::DataConverter() = default;

        xcmg_proto::OpencvImage
        DataConverter::ConvertImageMsg(const cv::Mat& _image_data) {
            xcmg_proto::OpencvImage image_msg;
            image_msg.set_cols(_image_data.cols);
            image_msg.set_rows(_image_data.rows);
            image_msg.set_elt_type(_image_data.type());
            image_msg.set_mat_data((char*)_image_data.data,
                                   _image_data.cols * _image_data.rows *
                                       _image_data.elemSize());

            return image_msg;
        }
    }   // namespace utils
}   // namespace xict_driver